<div class="container">
    <!-- login -->
    <div class="login-bg">
        <div class="wrap clearfix">
            <div class="login-right">
                <h3>账号密码登录</h3>
                <div class="login-border clearfix">
                    <div class="login-icon"><img src="/public/uploads/timages/login-icon1.png" /></div>
                    <input class="login-input" type="text" placeholder="请输入手机号" name="mobile" id="mobile"/>
                </div>
                <div class="login-border clearfix">
                    <div class="login-icon"><img src="/public/uploads/timages/login-icon2.png" /></div>
                    <input class="login-input" type="password" placeholder="请输入账户密码" name="password" id="password"/>
                </div>
                <input type="hidden" data-ischeck="{$check_verify}" name="checkverify" id="checkverify" value="0" />
                <div class="login-code clearfix" id="yan" style="display: none">
                    <input type="text" placeholder="请输入验证码" name="verify" id="verify"/>
                    <div class="login-c-img"><img src="{:captcha_src()}" alt="verify" style="height: 48px" onclick="this.src='{:captcha_src()}?d='+Math.random();" title="点击刷新" id/></div>
                </div>
                <div class="login-mt clearfix">
                    <div class="login-selector">
                        <input tabindex="1" name="auto" type="checkbox" id="auto">
                        <label for="auto">自动登录</label>
                    </div>
                    <div class="login-text"><a href="{:url('member/login/forgotpassword')}">忘记密码？</a></div>
                </div>
                <input class="login-btn login" type="button" value="登录"/>
                <div class="logo-a"><a href="{:url('member/login/reg')}">立即注册</a></div>
            </div>
        </div>
    </div>
</div>

<!-- footer -->
<div class="footer foot-login">
    <div><a href="">关于我们</a>|<a href="">联系我们</a>|<a href="">购物指南</a>|<a href="">支付方式</a>|<a href="">售后方式</a>|<a href="">常见问题</a>|<a href="">联系客服</a></div>
    <div>沪ICP备12017354号-1营业执照    Copyright©2005-2014 上海喜宝供应链管理有限公司 版权所有,并保留所有权利</div>
</div>


<script type="text/javascript" src="/public/static/home/js/jquery-1.11.1.min.js"></script>
<!-- check -->
<script src="/public/static/home/js/icheck.js"></script>
<script>
    //input
    $(document).ready(function () {
        var callbacks_list = $('.demo-callbacks ul');
        $('.login-selector input').on('ifCreated ifClicked ifChanged ifChecked ifUnchecked ifDisabled ifEnabled ifDestroyed', function (event) {
            callbacks_list.prepend('<li><span>#' + this.id + '</span> is ' + event.type.replace('if', '').toLowerCase() + '</li>');
        }).iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%'
        });
    });
    $(function(){
        $(".login").click(function(){
            var mobile=$('#mobile').val();
            var password=$('#password').val();
            var checkverify=$('#checkverify').val();
            var verify=$('#verify').val();
            var auto=$("#auto").prop("checked") ? 1 :0;
            if(mobile==''){
                alert("请输入手机号码");
                $("#mobile").focus();
                return false;
            }else if (!/^1[3|4|5|7|8][0-9]{9}$/.test(mobile)) {
                alert("手机号码格式不正确");
                $("#mobile").focus();
                return false;
            }else if(password==''){
                alert("请输入密码");
                $("#password").focus();
                return false;
            }else if(verify==''&&checkverify=='1'){
                alert("请输入验证码");
                $("#verify").focus();
                return false;
            }else{
                $.ajax({
                    url:"{:url('member/login/dologin')}",
                    type:'post',
                    data:{'mobile':mobile,'password':password,'checkverify':checkverify,'verify':verify,'auto':auto},
                    success:function (data) {
                        if(data.code==200){
                            window.location.href="{:url('member/member/index')}";
                        }else{
                            if($('#checkverify').data('ischeck')==1){
                                $('#checkverify').val(1);
                                $('.login-code').show();
                            }
                            alert(data.msg);
                        }
                    },
                    error: function(err, data) {
                        console.log(err); 
                    }
                });
            }
        })
    })
</script>

</body>
</html>